package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cnswhy.cloud.server.common.entity.enumeration.SplitType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2021-03-02
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_customer_split")
@ApiModel(value = "CustomerSplit", description = "")
@AllArgsConstructor
public class CustomerSplit extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 客户ID
     */
    @ApiModelProperty(value = "客户ID")
    @NotNull(message = "客户ID不能为空")
    @TableField("customer_id")
    @Excel(name = "客户ID")
    private Long customerId;

    /**
     * 自定义下级费率
     */
    @ApiModelProperty(value = "自定义下级费率")
    @TableField("split_rate")
    @Excel(name = "自定义下级费率")
    private Long splitRate;

    /**
     * 下级商户号
     */
    @ApiModelProperty(value = "下级商户号")
    @TableField("down_customer_id")
    @Excel(name = "下级商户号")
    private Long downCustomerId;

    /**
     * 下级手机号
     */
    @ApiModelProperty(value = "下级手机号")
    @Length(max = 11, message = "下级手机号长度不能超过11")
    @TableField(value = "down_customer_phone", condition = LIKE)
    @Excel(name = "下级手机号")
    private String downCustomerPhone;

    /**
     * 1：已设置 0未设置
     */
    @ApiModelProperty(value = "1：已设置 0未设置")
    @Length(max = 1, message = "1：已设置 0未设置长度不能超过1")
    @TableField(value = "status", condition = LIKE)
    @Excel(name = "1：已设置 0未设置")
    private String status;

    /**
     * 下级商户费率
     */
    @ApiModelProperty(value = "下级商户费率")
    @TableField("curr_rate")
    @Excel(name = "下级商户费率")
    private BigDecimal currRate;

    /**
     * 本级分成比例
     */
    @ApiModelProperty(value = "本级分成比例")
    @TableField("up_rate")
    @Excel(name = "本级分成比例")
    private BigDecimal upRate;

    /**
     * 分润类型
     */
    @ApiModelProperty(value = "分润类型")
    @Length(max = 255, message = "分润类型长度不能超过255")
    @TableField(value = "split_type", condition = LIKE)
    @Excel(name = "分润类型")
    private SplitType splitType;

    @TableField(exist = false)
    private String verifyFlag;
    @TableField(exist = false)
    private Integer downCount;
    @TableField(exist = false)
    private Integer downDownCount;





    @Builder
    public CustomerSplit(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long customerId, Long splitRate, Long downCustomerId, String downCustomerPhone, String status, 
                    BigDecimal currRate, BigDecimal upRate, SplitType splitType) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.customerId = customerId;
        this.splitRate = splitRate;
        this.downCustomerId = downCustomerId;
        this.downCustomerPhone = downCustomerPhone;
        this.status = status;
        this.currRate = currRate;
        this.upRate = upRate;
        this.splitType = splitType;
    }

}
